<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>商家我的订单</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f9f9f9;
            padding: 20px;
        }
        .container {
            max-width: 800px;
            margin: auto;
            background: white;
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        }
        h2 {
            text-align: center;
        }
        table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 20px;
        }
        th, td {
            padding: 10px;
            text-align: left;
            border-bottom: 1px solid #ccc;
        }
        th {
            background-color: #007bff;
            color: white;
        }
        tr:hover {
            background-color: #f1f1f1;
        }
        .status {
            text-align: center;
            margin-top: 20px;
        }
    </style>
</head>
<body>

<div class="container">
    <h2>商家我的订单</h2>
    <table>
        <thead>
            <tr>
                <th>订单号</th>
                <th>商品名称</th>
                <th>数量</th>
                <th>价格 (元)</th>
                <th>状态</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody id="order-list">
            <tr>
                <td>1001</td>
                <td>商品A</td>
                <td>2</td>
                <td>100.00</td>
                <td>待发货</td>
                <td><button>发货</button></td>
            </tr>
            <tr>
                <td>1002</td>
                <td>商品B</td>
                <td>1</td>
                <td>50.00</td>
                <td>已发货</td>
                <td><button>查看详情</button></td>
            </tr>
            <tr>
                <td>1003</td>
                <td>商品C</td>
                <td>3</td>
                <td>150.00</td>
                <td>已完成</td>
                <td><button>查看详情</button></td>
            </tr>
        </tbody>
    </table>
    <div class="status" id="statusMessage"></div>
</div>

<script>
    // 示例操作按钮的功能（实际操作应与后端结合）
    document.querySelectorAll('button').forEach(button => {
        button.addEventListener('click', function() {
            const orderRow = this.parentNode.parentNode;
            const orderId = orderRow.cells[0].innerText;
            const action = this.innerText;

            let message;
            if (action === '发货') {
                message = `订单 ${orderId} 已标记为发货！`;
            } else if (action === '查看详情') {
                message = `查看订单 ${orderId} 的详细信息。`;
            }

            document.getElementById('statusMessage').innerText = message;
        });
    });
</script>

</body>
</html>
